package com.flute.haflute.monitor;

import java.util.HashMap;
import java.util.Map;

/**
 * 通用状态汇报和跟踪接口<br>
 * 当某模块或者任务需要向控制中心汇报状态时，向本接口发送消息，或者注册状态封装类
 * 
 */
public class GeneralStatusCenter {

	private static GeneralStatusCenter instance = new GeneralStatusCenter();

	String myId;

	StatusMessage status;

	public static GeneralStatusCenter getInstance() {
		return instance;
	}

	public void registerReporter(GeneralStatusReporter reporter) {

	}

	public void unRegisterReporter(GeneralStatusReporter reporter) {

	}

	public void report(StatusMessage status) {
		Map<String, StatusMessage> map = new HashMap<String, StatusMessage>();
		map.put(getMyId(), status);
		MessageTransfer.localMsgSend("reportStatusMessage", map);
	}

	public StatusMessage getStatusMessage() {
		return status;
	}

	public String getMyId() {
		return myId;
	}

	public void setMyId(String myId) {
		this.myId = myId;
	}

	/**
	 * @return the status
	 */
	public StatusMessage getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(StatusMessage status) {
		this.status = status;
	}

}
